package com.cloudlead.fleetAction.action;

import com.cloudlead.common.lang.annotation.Label;
import com.cloudlead.common.lang.persistence.EasyuiGridData;
import com.cloudlead.common.worker.action.impl.AbstractActionFactory;
import com.cloudlead.common.worker.annotation.Action;
import com.cloudlead.common.worker.annotation.Order;
import com.cloudlead.fleetAction.BusinessModules;
import com.cloudlead.fleetAction.service.FuelRechargeSer;
import com.cloudlead.fleetService.FuelRechargeService;
import com.cloudlead.fleetService.vo.FuelRechargeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * Created by Jinnoo on 2015/8/12.
 */
@Controller
public class FuelRechargeActionFactory extends AbstractActionFactory implements FuelRechargeService {
    public FuelRechargeActionFactory() {
        super(BusinessModules.FuelRecharge);
    }

    @Autowired
    FuelRechargeSer fuelRechargeSer;


    @Action
    @Order(5)
    @Label("查询油卡充值记录")
    public EasyuiGridData findAllFuelRecharge(FuelRechargeVo vo,  @Label("页数")int page,@Label("条数") int rows) {
           return new EasyuiGridData(fuelRechargeSer.findAllFuelRecharge(vo, page, rows),
                "accountNumber,agent,comment,flag,id,oilCardNumber,payDate,rechargeAmount,status,tbBankAccountId" +
                        "baseOilCard.id oilCardId," +
                        "baseOilCard.endMoney endMoney," +
                        "baseOilCard.accountNumber oilCardName," );
    }

    @Action
    @Order(5)
    @Label("新增油卡充值记录")
    public void createFuelRecharge(FuelRechargeVo vo) {
        fuelRechargeSer.createFuelRecharge(vo);
    }

    @Action
    @Order(5)
    @Label("撤销副卡充值记录")
    public void editFuelRecharge( @Label("油卡充值ID")String id) {
        fuelRechargeSer.editFuelRecharge(id);
    }

    @Action
    @Order(5)
    @Label("撤销主卡充值记录")
    public void editMainFuelRecharge( FuelRechargeVo vo) {
        fuelRechargeSer.editMainFuelRecharge(vo);
    }
}
